<template>
	<view class="interest_list">
		<view class="van-nav-bar van-nav-bar--fixed">
			<view class="van-nav-bar__content">
				<view class="van-nav-bar__left" @click="back">
					<u-icon name="arrow-left" color="#fff" size="32rpx"></u-icon>
				</view>
				<view class="van-nav-bar__title van-ellipsis" style="color: #fff;margin-left: 66rpx;">{{common.user.default[7]}}</view>
				<view>
				</view>
			</view>
		</view>
		
		<view class="new-list">
			<view class="new-top">
				<view :class="item.id == finaData.fid?'new-item-check':''" @tap="finaData.fid = item.id" class="new-item" v-for="(item,index) in finaList" :key="index">
					<text>{{item.day}}{{common.hall3[0]}} </text>
					<text> {{item.fenbi*100}}%{{common.user.default[18]}}</text>
				</view>
				<!-- <view class="new-item">
					<text>15天     </text>
					<text> 6.5%利率</text>
				</view>
				<view class="new-item">
					<text>15天     </text>
					<text> 6.5%利率</text>
				</view>
				<view class="new-item">
					<text>15天     </text>
					<text> 6.5%利率</text>
				</view> -->
			</view>
			<view class="box-ntitle" style="margin-top: 42rpx;">
				{{common.newInterset[0]}}
			</view>
			<view class="box-ninput">
			
					<input type="text" :placeholder="common.user.default[12]"  v-model="finaData.moneys">
				<text class="max">{{common.newInterset[1]}}</text>
				
			</view>
			
		</view>
		<view class="sun-itn" @tap="setfinaBtn">
			{{common.newInterset[2]}}
		</view>
		
		<!-- <view class="list">
			<view class="items" v-for="item in finaList" :key="item.id">
				<view class="it_top">
					<view>
						<text>{{common.user.default[16]}}:</text>
						<text style="font-weight: 700; color: #222; font-size: 32rpx;">
							{{item.moneys}}
						</text>
					</view>
					<view>
						{{common.user.default[17]}}: {{item.endtime_text}}
					</view>
				</view>
				<view class="it_foo">
					<text>{{common.user.default[18]}}： {{item.fenbi}}%</text>
					<text>{{common.user.default[19]}}: {{item.days}} {{common.user.default[20]}}</text>
				</view>
			</view>
			
			<empty :promptText="common.empty[0]" :showEmpty="finaList.length == 0" />
		</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				finaList: [],
				finaData: {
					moneys: '',
					fid: ''
				},
			};
		},
		computed: {
			common() {
				return this.$t("common")
			},
		},
		onLoad() {
			this.getfina()
		},
		methods: {
			back(){
				uni.navigateBack()
			},
			setfinaBtn() {
				if (!this.finaData.fid || !this.finaData.moneys) return
				const token = uni.getStorageSync('token')
				this.$u.api.setting.setfina(token, this.finaData).then(res => {
					if (res.code == 1) {
						
						uni.showToast({
							title: this.common.user.default[15],
							icon: 'none'
						});
						this.finaData = {
							moneys: '',
							fid: ''
						}
					}
				})
			
			},
			getfina() {
				const token = uni.getStorageSync('token')
				this.$u.api.setting.getfina(token).then(res => {
					this.finaList = res.data
					this.finaData.fid = res.data[0].id
				})
			},
			// getfinas() {
			// 	const token = uni.getStorageSync('token')
			// 	this.$u.api.setting.getfinas(token).then(res => {
			// 		this.finasList = res.data 
			// 	})
			// },
			
		}
	}
</script>

<style lang="scss" scoped>
.interest_list{
	padding-top: 70rpx;
	min-height: 100vh;
	.van-nav-bar{
		background-color: #1a1a1a;
	}
	
	.list{
		.items{
			margin-bottom: 10rpx;
			display: flex;
			flex-direction: column;
			justify-content: space-around;
			padding: 10rpx 30rpx;
			height: 120rpx;
			background-color: #fff;
			.it_top{
				display: flex;
				justify-content: space-between;
				& > view:last-child{
					color: #ed742e;
					font-size: 22rpx;
				}
			}
			.it_foo{
				display: flex;
				justify-content: space-between;
			}
		}
	}
	
	.new-list{
		width: 750rpx;
		height: 468rpx;
		background: #222328;
		padding: 0 26rpx;
		padding-top: 18rpx;
		.new-top{
			
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;;
			
			.new-item{
				margin-top: 24rpx;
				width: 340rpx;
				height: 76rpx;
				border-radius: 8rpx 8rpx 8rpx 8rpx;
				border: 1rpx solid #FFFFFF;
				display: flex;
				align-items: center;
				justify-content: space-evenly;
				font-family: PingFang SC, PingFang SC;
				font-weight: bold;
				font-size: 32rpx;
				color: #FFFFFF;
			}
			.new-item-check{
				border: none;
				color: #000;
				background: #03E4DF;
			}
		}
		.box-ntitle{
			font-family: PingFang SC, PingFang SC;
			font-weight: 500;
			font-size: 26rpx;
			color: #FFFFFF;
		}
		
		.box-ninput{
			margin-top: 20rpx;
			width: 700rpx;
			height: 100rpx;
			background: #2A2D34;
			border-radius: 8rpx 8rpx 8rpx 8rpx;
			border: 2rpx solid #6F6F6F;
			display: flex;
			align-items: center;
			padding: 0 20rpx;
			position: relative;
			input{
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 24rpx;
				color: #FFFFFF;
				flex: 1;
			}
			.fz-icon{
				width: 56rpx;
				height: 56rpx;
			}
			.balue-new{
				position: absolute;
				top: 12rpx;
				right: 22rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: bold;
				font-size: 24rpx;
				color: #FFFFFF;
			}
			.max{
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 24rpx;
				color: #03E4DF;
				margin-right: 20rpx;
			}
			.box1{
				width: 1rpx;
				height: 24rpx;
				margin-right: 20rpx;
				background-color: #535354;
			}
			.box2{
				width: 44rpx;
				height: 44rpx;
				margin-right: 12rpx;
			}
			.box3{
				font-family: PingFang SC, PingFang SC;
				font-weight: 500;
				font-size: 24rpx;
				color: #FFFFFF;
				margin-right: 26rpx;
			}
		}
	}
	.sun-itn{
		margin-left: 22rpx;
		margin-top: 30rpx;
		width: 708rpx;
		height: 88rpx;
		background: #03E4DF;
		border-radius: 8rpx 8rpx 8rpx 8rpx;
		line-height: 88rpx;
		text-align: center;
		font-family: PingFang SC, PingFang SC;
		font-weight: bold;
		font-size: 32rpx;
		color: #111111;
	}
}
</style>
